<?php
class EvaluatedanesthesiologistsController extends AppController{
 	public function insert($data){
		$this->data['Evaluatedanesthesiologist']['claimid']=$data[0];
		$this->data['Evaluatedanesthesiologist']['firstname']=$data[1];
		$this->data['Evaluatedanesthesiologist']['middlename']=$data[2];
		$this->data['Evaluatedanesthesiologist']['lastname']=$data[3];
		$this->data['Evaluatedanesthesiologist']['serviceperformed']=$data[5];
		$this->data['Evaluatedanesthesiologist']['accreditationcode']=$data[4];
		$this->data['Evaluatedanesthesiologist']['date']=date('Y-m-d',strtotime($this->toDate($data[6])));
		$this->data['Evaluatedanesthesiologist']['rvs']=$data[7];
		$this->data['Evaluatedanesthesiologist']['rvu']=$data[8];
		$this->data['Evaluatedanesthesiologist']['pcf']=$data[9];
		$this->data['Evaluatedanesthesiologist']['actualcharge']=str_replace(',','',$data[10]);
		$this->data['Evaluatedanesthesiologist']['benefitclaim']=str_replace(',', '', $data[11]);
		$this->data['Evaluatedanesthesiologist']['status']=1;		
		
		$this->Evaluatedanesthesiologist->create();		
		$this->Evaluatedanesthesiologist->save($this->data);
	}
	private function toDate($date){
		$y=substr($date,4,4);
		$m=substr($date,0,2);
		$d=substr($date,2,2);
		$date=$y.'-'.$m.'-'.$d;		
		return $date;
	}
	public function getAnesthesilogist($claimid){
		$this->view='Json';
		
		$condition=array('claimid'=>$claimid);
		$data=$this->Evaluatedanesthesiologist->find('all', array('conditions'=>$condition));
		
		$this->set('data', $data);									
		$this->set('json', 'data');		
	}
	public function setStatus($id, $status){
		$this->data['Evaluatedanesthesiologist']['id']=$id;
		$this->data['Evaluatedanesthesiologist']['status']=$status;
		
		$this->Evaluatedanesthesiologist->save($this->data);
	}
	public function update(){
		//alert("id="+id+"&rvs="+rvs+"&rvu="+rvu+"&pcf="+pcf+"&bc="+bc+"&p="+p);
		$this->data['Evaluatedanesthesiologist']['id']=$_POST['id'];
		$this->data['Evaluatedanesthesiologist']['serviceperformed']=$_POST['p'];
		$this->data['Evaluatedanesthesiologist']['rvs']=$_POST['rvs'];
		$this->data['Evaluatedanesthesiologist']['rvu']=$_POST['rvu'];
		$this->data['Evaluatedanesthesiologist']['pcf']=$_POST['pcf'];
		$this->data['Evaluatedanesthesiologist']['benefitclaim']=$_POST['bc'];
		
		$this->Evaluatedanesthesiologist->save($this->data);
	}
}
?>